//
//  MovieTableViewCell.m
//  豆瓣
//
//  Created by lanou3g on 15/12/12.
//  Copyright © 2015年 HaiTeng. All rights reserved.
//

#import "MovieTableViewCell.h"
#import "UIImageView+WebCache.h"



@implementation MovieTableViewCell




//重写model的set方法，赋值
- (void)setModel:(MovieListModel *)model
{
    if (model) {
        _model = model;
    }

    self.title_cell.text = model.movieName;
    [self.poster_cell sd_setImageWithURL:[NSURL URLWithString:model.pic_url]];
}






- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    
    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self addAllViews];
        
    }
    
    return self;
    
}


- (void)addAllViews
{
    
    self.imageVV = [[UIImageView alloc] init];
    self.imageVV.image = [UIImage imageNamed:@"bg_eventlistcell"];
    [self addSubview:self.imageVV];
    
    //设置图片
    self.poster_cell = [[UIImageView alloc] init];
//    self.poster_cell.backgroundColor = [UIColor yellowColor];
    
    [self.imageVV addSubview:self.poster_cell];
   
    //设置电影名
    self.title_cell = [[UILabel alloc] init];
//    self.title_cell.backgroundColor = [UIColor grayColor];
//    self.title_cell.text = @"活动开始的考虑撒了点击时";
    [self.imageVV addSubview:self.title_cell];
    
}


- (void)layoutSubviews
{
    
    [super layoutSubviews];
    
//    //背景图
    self.imageVV.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
    
    
    //设置图片
    self.poster_cell.frame = CGRectMake(10, 5, self.frame.size.width / 3 - 30, self.frame.size.height - 10);
    
   

    //设置电影名
    self.title_cell.frame = CGRectMake(CGRectGetMaxX(self.poster_cell.frame) + 15, self.frame.size.height / 2 - 15, self.frame.size.width - self.title_cell.frame.origin.x, 30);
    
    
}




@end
